﻿CREATE PROCEDURE [dbo].[DepartmentsDelete]
(
	@Original_Id int,
	@Original_MD datetime,
	@MW varchar(50) 
)
AS
DECLARE @strMsg nvarchar(500), @intRet int, @intErrCode int
	SET NOCOUNT OFF;

SELECT @intErrCode = 1, 
@strMsg = 'Нельзя удалять строки из справочника подразделений!'
RAISERROR (@strMsg, 11, 1)
RETURN @intErrCode


DELETE FROM [CO].[Departments] WHERE Id = @Original_Id AND MD = @Original_MD
RETURN @@error


